package com.tyk.bookstore.back.platform.model.query;

import com.tyk.bookstore.back.platform.model.constant.AreaValidateConstant;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.*;
import lombok.Data;

import java.io.Serial;
import java.io.Serializable;
/**
 * @author tyk
 * @description 行政区域
 */
@Data
@Schema(name = "AreaAddQuery", description = "行政区域")
public class AreaAddQuery implements Serializable {

    @Serial
    private static final long serialVersionUID = 1L;

    @Schema(description = "行政区划代码")
    @NotNull
    @Min(value = 1)
    private Long code;

    @Schema(description = "父级行政区划代码")
    @NotNull
    @Min(value = 0)
    private Long parentCode;

    @Schema(description = "名称")
    @NotBlank
    @Size(min = AreaValidateConstant.NAME_MIN_LENGTH, max = AreaValidateConstant.NAME_MAX_LENGTH)
    @Pattern(regexp = AreaValidateConstant.NAME_REGEXP)
    private String name;

}
